import pymysql

try:
    connectiont = pymysql.connect(
        host = '119.45.203.8', # 主机名
        user = 'root',      # 数据库用户名
        password = 'zsy123456',  # 数据库密码
        db = 'pythondemo',      # 数据库名
        charset = 'utf8',   # 字符集编码
        cursorclass = pymysql.cursors.DictCursor, # 游标类型,
        port = 3301  # 端口
    )
    print(connectiont)
    cursor = connectiont.cursor()
except Exception as e:
    print(e)



